//
//  AppDelegate+Helper.m
//  lvfj
//
//  Created by lvfeijun on 2020/1/10.
//  Copyright © 2020 Goudu KuaiEx Technology(Shenzhen)Co.,ltd. All rights reserved.
//

#import "AppDelegate+Helper.h"
#import "lvfjCommon.h"

@implementation AppDelegate (Helper)

#pragma mark 动态闪屏
//根据屏幕尺寸自动选择合适尺寸的启动图片
- (void)configLaunchImage {
    /*
     1.Lauch Screen File 设置  LaunchScreen
     2.LaunchScreen.storyboard 的viewctl 设置 storyboard
     */
    UIViewController *vc = [[UIStoryboard storyboardWithName:@"LaunchScreen" bundle:nil] instantiateViewControllerWithIdentifier:@"LaunchScreen"];
    UIView *launchView = vc.view;
    UIWindow *mainWindow = [UIApplication sharedApplication].keyWindow;
    launchView.frame = [UIApplication sharedApplication].keyWindow.frame;
    [mainWindow addSubview:launchView];
    UIImageView *imageView=[[UIImageView alloc]init];
//    [imageView sd_setImageWithURL:[NSURL URLWithString:@"http://pic15.nipic.com/20110628/1369025_192645024000_2.jpg"]];
    imageView.image = [UIImage imageNamed:@"launchimg1"];
    //根据需求添加约束最好
    imageView.frame = CGRectMake(0, 0, ScreenWidth, ScreenHeight);
    imageView.backgroundColor=[UIColor whiteColor];
    [launchView addSubview:imageView];
    [NSTimer scheduledTimerWithTimeInterval:1 target:self selector:@selector(removeLaunchImage) userInfo:nil repeats:NO];
}
-(void)removeLaunchImage{
    [self.launchView removeFromSuperview];
    //设置rootViewController的代码

}

#pragma mark 网络设置
//-(void)setNetwork{
//    [MuHotZYNetworkAccessibity start];
//    [MuHotZYNetworkAccessibity setAlertEnable:YES];
//
//    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(networkChanged:) name:ZYNetworkAccessibityChangedNotification object:nil];
//}
//- (void)networkChanged:(NSNotification *)notification {
//   ZYNetworkAccessibleState state = MuHotZYNetworkAccessibity.currentState;
//    switch (state) {
//        case ZYNetworkChecking:{
//
//        }
//            break;
//        case ZYNetworkUnknown:{
//
//             }
//                 break;
//        case ZYNetworkAccessible:{
//
//             }
//                 break;
//
//        case ZYNetworkRestricted:{
//
//        }
//            break;
//
//        default:
//            break;
//    }
//}

#pragma mark 友盟设置
//-(void)setUMeng:(NSDictionary *)launchOptions {
//    [UMConfigure initWithAppkey:@"5dce0f4a0cafb2c8860008e0" channel:nil];
//    [UMConfigure setEncryptEnabled:YES];
//    [UMConfigure setLogEnabled:YES];
//    [UMessage setAutoAlert:YES];
//    [UMessage setBadgeClear:YES];
//
//    [UMCommonLogManager setUpUMCommonLogManager];
//
//    // Push功能配置
//    UMessageRegisterEntity * entity = [[UMessageRegisterEntity alloc] init];
//    entity.types = UMessageAuthorizationOptionBadge|UMessageAuthorizationOptionAlert|UMessageAuthorizationOptionSound;
//    //如果你期望使用交互式(只有iOS 8.0及以上有)的通知，请参考下面注释部分的初始化代码
//    if (([[[UIDevice currentDevice] systemVersion]intValue]>=8)&&([[[UIDevice currentDevice] systemVersion]intValue]<10)) {
//            UIMutableUserNotificationAction *action1 = [[UIMutableUserNotificationAction alloc] init];
//            action1.identifier = @"action1_identifier";
//            action1.title=@"打开应用";
//            action1.activationMode = UIUserNotificationActivationModeForeground;//当点击的时候启动程序
//
//            UIMutableUserNotificationAction *action2 = [[UIMutableUserNotificationAction alloc] init];  //第二按钮
//            action2.identifier = @"action2_identifier";
//            action2.title=@"忽略";
//            action2.activationMode = UIUserNotificationActivationModeBackground;//当点击的时候不启动程序，在后台处理
//            action2.authenticationRequired = YES;//需要解锁才能处理，如果action.activationMode = UIUserNotificationActivationModeForeground;则这个属性被忽略；
//            action2.destructive = YES;
//            UIMutableUserNotificationCategory *actionCategory1 = [[UIMutableUserNotificationCategory alloc] init];
//            actionCategory1.identifier = @"category1";//这组动作的唯一标示
//            [actionCategory1 setActions:@[action1,action2] forContext:(UIUserNotificationActionContextDefault)];
//            NSSet *categories = [NSSet setWithObjects:actionCategory1, nil];
//            entity.categories=categories;
//        }
//        //如果要在iOS10显示交互式的通知，必须注意实现以下代码
//        if ([[[UIDevice currentDevice] systemVersion]intValue]>=10) {
//            UNNotificationAction *action1_ios10 = [UNNotificationAction actionWithIdentifier:@"action1_identifier" title:@"打开应用" options:UNNotificationActionOptionForeground];
//            UNNotificationAction *action2_ios10 = [UNNotificationAction actionWithIdentifier:@"action2_identifier" title:@"忽略" options:UNNotificationActionOptionForeground];
//
//            //UNNotificationCategoryOptionNone
//            //UNNotificationCategoryOptionCustomDismissAction  清除通知被触发会走通知的代理方法
//            //UNNotificationCategoryOptionAllowInCarPlay       适用于行车模式
//            UNNotificationCategory *category1_ios10 = [UNNotificationCategory categoryWithIdentifier:@"category1" actions:@[action1_ios10,action2_ios10]   intentIdentifiers:@[] options:UNNotificationCategoryOptionCustomDismissAction];
//            NSSet *categories = [NSSet setWithObjects:category1_ios10, nil];
//            entity.categories=categories;
//        }
//    [UNUserNotificationCenter currentNotificationCenter].delegate=self;
//    [UMessage registerForRemoteNotificationsWithLaunchOptions:launchOptions Entity:entity completionHandler:^(BOOL granted, NSError * _Nullable error) {
//        if (granted) {
//        }else{
//        }
//    }];
//}

@end
